package com.song.EMS.utils;

import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.Date;

/**转换日期格式
 * @author song
 */
public class DateFormatUtil {
    private static final SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
    public static String getDate(Date date) {
        return date == null?"-":format.format(date);
    }
    public static Long getTime(String date) {
        long time = 0;
        try {
            time = format.parse(date).getTime();
        } catch (ParseException e) {
            e.printStackTrace();
        }
        return time;
    }
}
